import React, { Component } from 'react'
import {HashRouter as Hash , BrowserRouter as History, Route ,Switch, Redirect} from "react-router-dom"
import NotFount from './errorPage/404'
import ManyCom from './errorPage/503'
// import LoginCom from './login'
import MainCom from './main'
// import LazyLoad from "../utils/lazyload"
import LazyLoad from '../utils/lazyload'
export class MainRouter extends Component {
    render() {
        return (
            <div>
                <Hash
                    basename=""
                >
                    <Route component={MainLayout}></Route>
                </Hash>
            </div>
        )
    }
}
// 页面主视图
export class MainLayout extends Component{
    render(){
        return(
            <div className="layout">
                <Switch>
                    <Route path="/" exact render={()=><Redirect to="/login"/>}></Route> 
                    <Route path="/login" component={LazyLoad(()=>import("./login"))}></Route> 
                    <Route path="/main" component={LazyLoad(()=>import("./main"))}></Route> 
                    {/* <Route path="/main" component={MainCom}></Route> */}
                    <Route path="/404" component={LazyLoad(()=>import("./errorPage/404"))}></Route>
                    <Route path="/503" component={LazyLoad(()=>import("./errorPage/503"))}></Route>
                    <Route render={()=><Redirect to="/main"/>}></Route>
                </Switch>
            </div>
        )
    }
}